﻿using System;
using System.Data;

namespace _12306Bot.Common
{
    public class Configuration
    {
        /// <summary>
        /// 获取坐席
        /// </summary>
        /// <returns></returns>
        public static DataTable getSeatTypeDataTable()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("SeatName");
            dt.Columns.Add("SeatID");

            setDr(dt, "硬座", "1");
            setDr(dt, "软座", "2");
            setDr(dt, "硬卧", "3");
            setDr(dt, "软卧", "4");
            //setDr(dt, "包厢硬卧", "5");
            setDr(dt, "二等座", "O");
            setDr(dt, "一等座", "M");
            setDr(dt, "高级软卧", "6");
            setDr(dt, "一等软座", "7");
            setDr(dt, "二等软座", "8");
            setDr(dt, "商务座", "9");
            setDr(dt, "特等座", "P");
            //setDr(dt, "观光座", "Q");
            //setDr(dt, "一等包座", "S");
            //setDr(dt, "一人软包", "H");

            return dt;
        }

        /// <summary>
        /// 获取票种
        /// </summary>
        /// <returns></returns>
        public static DataTable getTicketTypeDataTable()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("TicketName");
            dt.Columns.Add("TicketID");

            setDr(dt, "成人票", "1");
            setDr(dt, "儿童票", "2");
            setDr(dt, "学生票", "3");
            setDr(dt, "残军票", "4");

            return dt;
        }

        /// <summary>
        /// 获取证件类别
        /// </summary>
        /// <returns></returns>
        public static DataTable getIDType()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("TypeName");
            dt.Columns.Add("TypeID");

            setDr(dt, "身份证", "1");
            setDr(dt, "港澳证", "C");
            setDr(dt, "台湾证", "G");
            setDr(dt, "护照", "B");

            return dt;
        }

        /// <summary>
        /// 设置DataRow
        /// </summary>
        /// <param name="dt">需要设置行的DataTable</param>
        /// <param name="DisplayMemberValue">显示值</param>
        /// <param name="ValueMemberValue">实际值</param>
        private static void setDr(DataTable dt, String DisplayMemberValue, String ValueMemberValue)
        {
            DataRow dr = dt.NewRow();
            dr[0] = DisplayMemberValue;
            dr[1] = ValueMemberValue;
            dt.Rows.Add(dr);
        }
    }
}
